package com.example.sample.activity;

import android.os.Bundle;
import android.view.View;

import com.example.app.BaseActivity;
import com.example.sample.R;
import com.umeng.analytics.MobclickAgent;

import java.util.HashMap;

/**
 * Created by LiangYu on 2017/10/10.
 */
public class UmengTestActivity extends BaseActivity implements View.OnClickListener{


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_umeng_test);
        findViewById(R.id.statistic).setOnClickListener(this);
        MobclickAgent.setDebugMode(true);
        // SDK在统计Fragment时，需要关闭Activity自带的页面统计，
        // 然后在每个页面中重新集成页面统计的代码(包括调用了 onResume 和 onPause 的Activity)。
        MobclickAgent.openActivityDurationTrack(false);
        // MobclickAgent.setAutoLocation(true);
        // MobclickAgent.setSessionContinueMillis(1000);
        // MobclickAgent.startWithConfigure(
        // new UMAnalyticsConfig(mContext, "4f83c5d852701564c0000011", "Umeng",
        // EScenarioType.E_UM_NORMAL));
        MobclickAgent.setScenarioType(this, MobclickAgent.EScenarioType.E_UM_NORMAL);
    }

    @Override
    public void onClick(View v) {
        HashMap<String ,String> map = new HashMap<>();
        map.put("type", "1");
        /*MobclickAgent.onEventValue(UmengTestActivity.this, "test_value", map, 1);
        MobclickAgent.onEvent(UmengTestActivity.this, "test_string", map);
        MobclickAgent.onEvent(UmengTestActivity.this, "test_string");*/
        MobclickAgent.onEvent(this, "new");
    }
}
